#include "menuscene.h"

MenuScene::MenuScene(QObject *parent) : QGraphicsScene(parent)
{
    MenuItem * newItem = new MenuItem(tr("New Game"), QPixmap(":/images/icon.png"));
    connect(newItem, SIGNAL(pressed()), this, SIGNAL(newGame()));
    newItem->setPos(100, 100);

    MenuItem * exitItem = new MenuItem(tr("Exit Game"), QPixmap(":/images/icon.png"));
    connect(exitItem, SIGNAL(pressed()), qApp, SLOT(quit()));
    exitItem->setPos(100, 200);

    m_menuItems << newItem << exitItem;

    addItem(newItem);
    addItem(exitItem);
    setSceneRect(0, 0, 800, 600);
}

MenuScene::~MenuScene()
{
    qDeleteAll(m_menuItems);
    m_menuItems.clear();
}

void MenuScene::drawBackground(QPainter *painter, const QRectF &rect)
{
    QRectF rSceneRect = sceneRect();
}

void MenuScene::drawForeground(QPainter *painter, const QRectF &rect)
{

}
